package com.changan.exception;

import com.changan.response.Result;
import com.changan.response.ResultCode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 项目名:    xinguan-parent
 * 类名称:      GlobalExceptionHandler
 * 创建人:     xsy
 * 类描述:
 * 创建时间:    2021/8/27 10:28
 * Version:    1.0
 */
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {

    @ExceptionHandler({ArithmeticException.class,NullPointerException.class})
    @ResponseBody
    public Result handlerArithmeticException(){
        log.error("1221");
        return  Result.error(ResultCode.ARITHMETIC_EXCEPTION);
    }
}
